/**
 * 
 */
package edu.cmu.mism.dgjava.data.ui.composites.bond;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

import edu.cmu.mism.dgjava.data.ui.composites.AbstractDataComposite;
import edu.cmu.mism.dgjava.utils.SWTUtils;
import edu.cmu.mism.dgjava.views.Messages;

/**
 * @author Ankit
 *
 */
public class BlackEuropeanComposite extends AbstractDataComposite{

	private static final String DEFAULT_STRIKE_PRICE = "100.00";
	private static final String DEFAULT_OPTION_LIFE = "1.00";
	private static final String DEFAULT_YIELD_VOLATILITY = "1.00%";
	
	private Group _priceModelGroup;
	
	private Label _strikePriceLbl;
	private Text _strikePriceTxt;

	private Label _optionLifeLbl;
	private Text _optionLifeTxt;

	private Label _yieldVolatilityLbl;
	private Text _yieldVolatilityTxt;

	@Override
	public void createControls(Composite parent) {
		
		Composite container = SWTUtils.createComposite(parent, 1, -1, 1);
		GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
		container.setLayoutData(gd);
		createPriceModelGroup(container);
		
	}

	private void createPriceModelGroup(Composite container) {

		GridData hGd = new GridData(GridData.FILL_HORIZONTAL);
		GridData labelGd = new GridData(GridData.HORIZONTAL_ALIGN_END);
		// strike price
		this._priceModelGroup = SWTUtils.createGroup(container,
				Messages.BondDataView_group_priceModel, 2, 2, -1,
				GridData.FILL_HORIZONTAL);
		this._strikePriceLbl = SWTUtils.createLabel(this._priceModelGroup,
				Messages.BondDataView_label_strikePrice, 1);
		this._strikePriceLbl.setLayoutData(labelGd);
		this._strikePriceTxt = SWTUtils.createTextBox(this._priceModelGroup,
				DEFAULT_STRIKE_PRICE); 
		hGd = new GridData(SWT.FILL, -1, true, false);
		this._strikePriceTxt.setLayoutData(hGd);
		this._strikePriceLbl.setLayoutData(hGd);

		// Option Life
		this._optionLifeLbl = SWTUtils.createLabel(this._priceModelGroup,
				Messages.BondDataView_label_optionLife, 1);
		this._optionLifeLbl.setLayoutData(labelGd);
		this._optionLifeTxt = SWTUtils.createTextBox(this._priceModelGroup,
				DEFAULT_OPTION_LIFE); 
		hGd = new GridData(SWT.FILL, -1, true, false);
		this._optionLifeTxt.setLayoutData(hGd);
		this._optionLifeLbl.setLayoutData(hGd);
		
		// Yield volatility
		this._yieldVolatilityLbl = SWTUtils.createLabel(this._priceModelGroup,
				Messages.BondDataView_label_yieldVolatility, 1);
		this._yieldVolatilityLbl.setLayoutData(labelGd);
		this._yieldVolatilityTxt = SWTUtils.createTextBox(this._priceModelGroup,
				DEFAULT_YIELD_VOLATILITY); 
		hGd = new GridData(SWT.FILL, -1, true, false);
		this._yieldVolatilityTxt.setLayoutData(hGd);
		this._yieldVolatilityLbl.setLayoutData(hGd);
		
	}

	@Override
	protected void validate() {
		// TODO Auto-generated method stub
		
	}


}
